package com.appspot.etao.model;

import javax.jdo.annotations.EmbeddedOnly;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;

import com.taobao.top.domain.UserCredit;

@PersistenceCapable
@EmbeddedOnly
public class UserCreditModel extends BaseModel {

	private static final long serialVersionUID = 3857264720908663967L;
	
//    @PrimaryKey
//    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Long id;
    
    /** 信用等级。 */
    @Persistent
	private Integer level;
    
    /** 信用总分。 */
    @Persistent
	private Integer score;
    
    /** 收到的评价总条数。 */
    @Persistent
	private Integer totalNum;
    
    /** 收到的好评总条数。 */
    @Persistent
	private Integer goodNum;
	
	private UserCredit userCredit;
	
	public UserCreditModel() {
		
	}
	
	public UserCreditModel(UserCredit userCredit) {
		setUserCredit(userCredit);
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Integer getLevel() {
		return level;
	}

	public void setLevel(Integer level) {
		this.level = level;
	}

	public Integer getScore() {
		return score;
	}

	public void setScore(Integer score) {
		this.score = score;
	}

	public Integer getTotalNum() {
		return totalNum;
	}

	public void setTotalNum(Integer totalNum) {
		this.totalNum = totalNum;
	}

	public Integer getGoodNum() {
		return goodNum;
	}

	public void setGoodNum(Integer goodNum) {
		this.goodNum = goodNum;
	}

	public UserCredit getUserCredit() {
		return userCredit;
	}

	public void setUserCredit(UserCredit userCredit) {
		this.userCredit = userCredit;
		
		this.level = userCredit.getLevel();
		this.score = userCredit.getScore();
		this.totalNum = userCredit.getTotalNum();
		this.goodNum = userCredit.getGoodNum();
	}
	
	public String toString() {
		StringBuffer sb = new StringBuffer("");
		sb.append("[");
		sb.append(level);
		sb.append(",");
		sb.append(score);
		sb.append(",");
		sb.append(totalNum);
		sb.append(",");
		sb.append(goodNum);
		sb.append("]");
		
		return sb.toString();
	}
}
